package com.gy.task;

import cn.hutool.core.util.IdUtil;
import com.gy.api.mobile.msg.dao.UserMessagesDao;
import com.gy.api.mobile.msg.domain.po.UserMessagesPO;

import java.util.Date;

public class UserMessageThread extends Thread {

    private UserMessagesDao userMessagesDao;

    private String userId;

    private String messageType;

    private String messageContent;


    public UserMessageThread(UserMessagesDao userMessagesDao, String messageType,String messageContent, String userId){
        this.userMessagesDao=userMessagesDao;
        this.userId=userId;
        this.messageType=messageType;
        this.messageContent=messageContent;
    }

    @Override
    public void run() {
        UserMessagesPO companyMessagePO=new UserMessagesPO();
        companyMessagePO.setId(IdUtil.getSnowflakeNextIdStr());
        companyMessagePO.setUserId(userId);
        companyMessagePO.setMessageContent(messageContent);
        companyMessagePO.setMessageType(messageType);
        companyMessagePO.setIsHandle(2);
        companyMessagePO.setDetailUrl("/");
        companyMessagePO.setCreateTime( new Date());
        userMessagesDao.insertSelective(companyMessagePO);
    }
}
